package com.itheima.mapper;


import com.itheima.project.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper//会通过动态代理自动生成对象存入容量池，输入mybatis
public interface DpetMapper {

    // @Select("select id,name,create_time,update_time from dept")
    List<Dept> list();

    // @Delete("delete from dept where id = #{id}")
    //#{}代表预编译preparesatament，${}代表直接编译satament
    void delete(Integer id);

    // @Insert("insert into dept(name,update_time,create_time)values(#{name},#{createTime},#{updateTime})")
    void addDept(Dept dept);

    // @Select("select id,name,create_time,create_time,update_time from dept where id  = #{id}")
    Dept getDeptById(Integer id);

    // @Update("update dept set name = #{name},update_time = #{updateTime} where id = #{id}")
    void modifyDept(Dept dept);

   // @Select("select emp.* , dept.name deptName from emp left join dept on emp.dept_id = dept.id")

}
